package examples.complex.model

import javax.inject.Singleton

/**
 * Created by Misty on 2015/6/5.
 */
@Singleton
class Repository {
    List<Person> persons = []

    public Repository() {
        persons << new Person(firstName: "Alexander", lastName: "Casall", gender: Gender.MALE)
        persons << new Person(firstName: "Bernd", lastName: "Grams", gender: Gender.MALE)
        persons << new Person(firstName: "Anna", lastName: "Schulze", gender: Gender.FEMALE)
        persons << new Person(firstName: "Andy", lastName: "Mueller", gender: Gender.NOT_SPECIFIED)
    }

    Person getPersonById(final int id) {
        return persons.find { it.id == id }
    }
}
